﻿@model iDMS.Models.DesignChange
@using iDMS.Models
@using MvcHtmlHelpers
@{
    ViewBag.Title = "Details";
}
<h3>
    Design Change: @Model.Identifier - <span class="accent">Details</span>
</h3>
<h3>
</h3>
<script type="text/javascript">
    $(function () {
        $("#tabs").tabs({ ajaxOptions: { global: false }, spinner: 'Retrieving data... <img src="/Content/Images/spinner.gif" border="0"/>' });
    });
</script>
<script type="text/javascript">
    $(function () {
        $("a.action").button();

    });
</script>
<div id="tabs">
    <ul>
        <li><a href="#tabs-1"><span>General Info</span></a></li>
        <li><a href="#tabs-2"><span>Workflow History</span></a></li>
        <li><a href="#tabs-3"><span>Adnotation</span></a></li>
        <li><a href="@Url.Action("DesignChangeSheets", "Drawing", new { id = Model.DesignChangeID })">
            <span>Changed Sheets</span></a></li>
        <li><a href="@Url.Action("DesignChangeDrawings", "Drawing", new { id = Model.DesignChangeID })">
            <span>Changed Drawing</span></a></li>
        <li><a href="#tabs-4"><span>Possible Actions</span></a></li>
    </ul>
    <div id="tabs-1">
        @Html.Partial("_DesignChangeDetails", Model)
    </div>
    <div id="tabs-2">
        @Html.Partial("_DesignChangelHistory", (List<DesignChangeLog>)ViewBag.History)
    </div>
    <div id="tabs-3">
        @Html.Partial("_AllNotes", (List<Note>)ViewBag.Notes)
        @Html.ActionLink("Add Note", "AddNote", new { id = Model.DesignChangeID })
    </div>
    <div id="tabs-4">
        @if (Model.DesignChangePhase.isDesignChangeEditable)
        {
            <div style="margin-top:20px">@Html.ActionLink("Edit", "Edit", new { id = Model.DesignChangeID }, new { @class = "action" })</div>
        }
        @foreach (WorkflowStep item in ViewBag.AllowedSteps)
        {
            <div style="margin-top:20px">@Html.ButtonIconActionLink("StepPerform", "DesignChange", new { id = Model.DesignChangeID, phase = item.PhaseTo }, item.ActionName, item.ActionIcon)</div>
        }
    </div>
</div>
<p>
    @Html.ActionLink("Back to List", "Index", null, new { @class = "btl" })
</p>
@Html.Partial("_AjaxDialog")
